//
// Tool for managing recording and playback
//

TOOL.Category = "Motion Tracker"
TOOL.Name = "Recording and replay"
TOOL.Command = nil
TOOL.ConfigName = ""

if CLIENT then
	language.Add( "Tool_ganimator_manager_name", "Recording and playback" )
	language.Add( "Tool_ganimator_manager_desc", "Manage recording and replay" )
	language.Add( "Tool_ganimator_manager_0", "Left Click: Start recording      Right Click: Stop recording      Reload: Replay" )
end

TOOL.LastLeft = os.time()
function TOOL:LeftClick()
	if os.time() > self.LastLeft and CLIENT and LocalPlayer():IsSuperAdmin() then
		self.LastLeft = os.time()
		
		math.randomseed( os.time() )
		RunConsoleCommand( "GA_StartRecording", "Recording" .. math.random(1, 10000) )
	end
end

TOOL.LastRight = os.time()
function TOOL:RightClick()
	if os.time() > self.LastRight and CLIENT and LocalPlayer():IsSuperAdmin() then
		self.LastRight = os.time()
		RunConsoleCommand( "GA_FinishRecording" )
	end
end

TOOL.LastReload = os.time()
function TOOL:Reload()
	if os.time() > self.LastReload and CLIENT and LocalPlayer():IsSuperAdmin() then
		self.LastReload = os.time()
		RunConsoleCommand( "GA_Replay" )
	end
end